<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>
<div class="admin_nrtop">
    <div class="ad_search">
        <form action="/admini/recommend/index/"  method="get" style="margin:0px" id="form1">
        <div class="search">
            <div class="soubox">
                <input type="text" id="name" name="name" value="<?php echo $this->name?$this->name:"";?>" placeholder="输入用户名或仓库号"/>
                <input type="hidden" id="starttime" name="starttime" value="<?php echo $this->starttime?$this->starttime:"";?>"/>
                <input type="hidden" id="endtime" name="endtime" value="<?php echo $this->endtime?$this->endtime:"";?>" />
            </div>
            <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
        </div>
        <div class="timebox">  
            <div class="ad_time" style="width:306px;">
                <div class="timefw">
                    <div class="time">
                        <!--点击后悬停样式为：<div class="timeselect t_on">-->
                        <div class="timeselect"  id="stime">
                            <span id="stimeval"><?php echo $this->starttime?$this->starttime:date("Y-m-d",mktime(0,0,0,date("m"),date("d")-7,date("Y")));?></span><i></i>
                        </div>
                        <div class="timeslelctbox">
                            <!---时间插件放此DIV-->
                        </div>
                    </div>
                    <div class="timezhi">
                        <span>至</span>
                    </div>
                    <div class="time" >
                        <div class="timeselect" id="etime">
                            <span id="etimeval"><?php echo $this->endtime?$this->endtime:date("Y-m-d");?></span><i></i>
                        </div>
                        <div class="timeslelctbox">
                            <!---时间插件放此DIV-->
                        </div>
                    </div>
                </div>
            </div>
            <div class="timeok">
                <a href="javascript:$('#form1').submit();">确定</a>
            </div>
        </div>
        </form>
    </div>
</div>
<div  class="biaoge">
    <div class="biaotbody">
        <table>
            <tr>
                <th class="li3">
                    <div class="lileft">&nbsp;</div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>用户昵称</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>仓库号</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>注册时间</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>推荐人昵称</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>推荐人仓库号</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>是否有效</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>完成运单数</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>返利金额</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>未完成运单数</span></div>
                </th>
                <th class="li10">
                    <div class="lileft"><span>待返利金额</span></div>
                </th>
            </tr>
        </table>
    </div>
     <div class="table">
         <table>
             <?php  if($this->RecommendList){
                foreach ($this->RecommendList as $Item) { ?> 
                 <tr>
                     <td class="li3">&nbsp;</td>
                     <td class="li10">
                         <div class="lileft">
                             <a class="indexa" href="/admini/manageuser/userdetail/id/<?php echo $Item->UserId;?>"><?php echo $Item->getUserItem($Item->UserId)->Nikename;?></a>
                         </div>
                     </td>
                     <td class="li10">
                         <div class="lileft">
                             <a class="indexa" href="/admini/managestore/index/?quick=<?php echo $Item->getUserItem($Item->UserId)->Storeno;?>"><?php echo $Item->getUserItem($Item->UserId)->Storeno;?></a>
                         </div>
                     </td>
                     <td class="li10">
                         <div class="lileft">
                             <?php echo $Item->CreateTime;?>
                        </div>
                     </td>
                     <td class="li10">
                         <div class="lileft yonghu">
                             <a class="indexa" href="/admini/manageuser/userdetail/id/<?php echo $Item->ReUserId;?>"><?php echo $Item->getUserItem($Item->ReUserId)->Nikename;?></a>
                        </div>
                     </td>
                     <td class="li10">
                         <div class="lileft">
                             <a class="indexa" href="/admini/managestore/index/?quick=<?php echo $Item->getUserItem($Item->ReUserId)->Storeno;?>"><?php echo $Item->getUserItem($Item->ReUserId)->Storeno;?></a>
                        </div>
                     </td>
                     <td class="li10">
                         <div class="lileft">
                             <?php echo $Item->IsAbledName;?>
                        </div>
                     </td>
                     <td class="li10">
                         <div class="lileft">
                             <?php echo $Item->getCountRebatesWay(Application_Model_Reward::IsAbled_Complete)>0?
                                     "<a class='indexa' href='/admini/recommend/reward/quick/".$Item->getUserItem($Item->UserId)->Storeno."/isComp/".Application_Model_Reward::IsAbled_Complete."'>".
                                     $Item->getCountRebatesWay(Application_Model_Reward::IsAbled_Complete)."</a>":0;?>
                        </div>
                     </td>
                     <td class="li10">
                         <div class="lileft">
                             <?php echo $Item->getSumRebatesWay(Application_Model_Reward::IsAbled_Complete)?$Item->getSumRebatesWay(Application_Model_Reward::IsAbled_Complete):0;?>
                        </div>
                     </td>
                     <td class="li10">
                         <div class="lileft">
                             <?php echo $Item->getCountRebatesWay(Application_Model_Reward::IsAbled_Unfinished)>0?
                                     "<a class='indexa' href='/admini/recommend/reward/quick/".$Item->getUserItem($Item->UserId)->Storeno."/isComp/".Application_Model_Reward::IsAbled_Unfinished."'>".
                                     $Item->getCountRebatesWay(Application_Model_Reward::IsAbled_Unfinished)."</a>":0;?>
                        </div>
                     </td>                     
                     <td class="li10">
                         <div class="lileft">
                             <?php echo $Item->getSumRebatesWay(Application_Model_Reward::IsAbled_Unfinished)?$Item->getSumRebatesWay(Application_Model_Reward::IsAbled_Unfinished):0;?>
                        </div>
                     </td>
                 </tr>
             <?php } }  if(!$this->RecommendList){
                echo "<font size='4' color='red'>暂无数据</font>";
                }?>   
         </table>
     </div>
 </div>
<div class="toolbar">
<?php
    echo $this->partial('paging.phtml', array("pages" => $this->RecommendAll,"pamas"=>"quick=$this->quick&starttime=$this->starttime&endtime=$this->endtime"));        
?>
</div>

<script>
    $(".lixiala").click(function(){
        $(".lixiala").attr("class","lixiala");
        $(".lixiala").next("div").attr("style","display:none;");
    
        $(this).attr("class","lixiala bton");
        $(this).next("div").attr("style","display:block;");
    });
    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".biaoxiala").length == 0){
            $(".lixiala").attr("class","lixiala");
            $(".lixiala").next("div").attr("style","display:none;");
        }
    });
    $("#stime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'stimeval',vel:'starttime',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
                $(".soubox #timescope").val("");
        }});
    });
    $("#etime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'etimeval',vel:'endtime',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
                $(".soubox #timescope").val("");
        }});
    });
</script>